var box = paper.rect(width * 2 / 3, 50, 100, 100).attr({
	'fill' : '#000'
});

box.drag(function(dx, dy, x, y, ev) {
	var dim = this.getBBox(true);
	this.toFront();
	this.attr({
		x : x - dim.width / 2,
		y : y - dim.height / 2
	});
});

var pathString = "M";

var lines = lines || [];

wall.drag(function(dx, dy, x, y, ev) {
	pathString += x + "," + y + " ";
	lines[lines.length - 1].attr({
		path : pathString,
		"stroke" : col,
		"stroke-width" : rad.value
	});
}, function() {
	lines[lines.length] = paper.path();
	pathString = "M";
}, function(x, y) {
	pathString += "M" + x + "," + y + "A";
});

$("color-picker-button").addEventListener("click", function() {
	removeChildren("pick-color");
	var xhr = new XMLHttpRequest();
	xhr.open("GET", "../color-picker.html", true);
	xhr.send(null);
	xhr.onreadystatechange = function() {
		if (xhr.readyState == 4) {
			$("pick-color").innerHTML = xhr.responseText;
			var script = document.createElement("script");
			script.src = "../static/js/color-picker-script.js";
			document.getElementsByTagName("body")[0].appendChild(script);
			$("pick-color").style.display = "block";
			$("wrapper").style.opacity = 0.9;
			$("wrapper").style.zIndex = 9999;
		}
	}
}, false);
